package com.dataart.training.crimequalification.domain;

import com.dataart.training.crimequalification.entity.IndiscretionEntity;
import com.dataart.training.crimequalification.entity.IntentEntity;

public class Guilt {

    private IntentEntity intent;
    private boolean withIntent;

    private IndiscretionEntity indiscretion;
    private boolean withIndiscretion;

    //-----------------------------------------------------------

    public Guilt(IntentEntity intent, IndiscretionEntity indiscretion) {

        this.intent = intent;
        this.indiscretion = indiscretion;

        this.withIntent = intent != null;
        this.withIndiscretion = indiscretion != null;

    }

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder("Вина: [ Умысел: ");
        if (withIntent) {
            sb.append(intent.getTextualValue()).append(" ]");
        } else {
            sb.append("нет ]");
        }

        sb.append("[ Неосторожность: ");

        if (withIndiscretion) {
            sb.append(indiscretion.getTextualValue()).append(" ]");
        } else {
            sb.append(" нет ]");
        }

        return sb.toString();

    }

    //-----------------------------------------------------------

    public IntentEntity getIntent() {
        return intent;
    }

    public void setIntent(IntentEntity intent) {
        this.intent = intent;
    }

    public boolean isWithIntent() {
        return withIntent;
    }

    public void setWithIntent(boolean withIntent) {
        this.withIntent = withIntent;
    }

    public IndiscretionEntity getIndiscretion() {
        return indiscretion;
    }

    public void setIndiscretion(IndiscretionEntity indiscretion) {
        this.indiscretion = indiscretion;
    }

    public boolean isWithIndiscretion() {
        return withIndiscretion;
    }

    public void setWithIndiscretion(boolean withIndiscretion) {
        this.withIndiscretion = withIndiscretion;
    }
}
